import os


class DaomuPipeline:
    def process_item(self, item, spider):
        filename = './data/{}/{}.txt'.format(
            item['parent_title'],
            item['son_title']
        )
        with open(filename, 'w') as f:
            f.write(item['novel_content'])

        return item
